{extend name='admin@public/content'}

{block name="button"}
<button data-open='{:url("$classuri/")}' data-title="返回列表" class='layui-btn layui-btn-sm layui-btn-primary'><i class='fa fa-arrow-left'></i> 返回列表</button>
{/block}

{block name='content'}

<!--右侧编辑区 开始-->
<div class="panel panel-default article-right" style="overflow:hidden;width: 960px;">
    <div class="panel-body">
        <form class="form-horizontal" data-auto="true" onsubmit="return false;">

            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon">标题</span>
                        <input maxlength="200" required="required"  name="title" value="{$vo.title|default=''}" title="标题不能为空哦" placeholder="请在这里输入标题" class="layui-input">
                        <input type="hidden" name="id" value='{$vo.id|default=""}'>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon">讲师</span>
                        <input  required="required" title="讲师不能为空哦" placeholder="请输入讲师" name='teacher' value="{$vo.teacher|default=''}" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon">课程时间</span>
                        <input id="teach_time"  title="课程时间不能为空哦" placeholder="请选择课程时间" name='teach_time' value="{$vo.teach_time|default=''}" class="layui-input">
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon">课程分类</span>
                        <select name='category_id' class='layui-select' style='display:block;width:30% !important;'>
                            {foreach $category_list as $key=>$value}
                            {if isset($vo.category_id) and $key == $vo.category_id}
                            <option  value='{$key}' selected>{$value}</option>
                            {else/}
                            <option  value='{$key}'>{$value}</option>
                            {/if}
                            {/foreach}
                        </select>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-12">
                    <div class="form-control" style="height:auto">
                        <label style="color:#333;font-size: 12px;">封面图片设置</label>
                        <div class="row nowrap">
                            <div class="col-xs-3" style="width:160px;">
                                <div class="upload-image-box" style="background-image: url({$vo.cover|default=$image})">
                                    <input value="{$vo.cover|default=$image}" type="hidden" name="cover">
                                </div>
                            </div>
                            <div class="col-xs-6">
                                <br>
                                <a data-file="one" data-type="jpg,png,jpeg" data-field="cover" class="btn btn-sm">上传图片</a>
                            </div>
                        </div>
                        <p class="help-block" style="margin-top:10px;color:#ccc;font-size: 12px;">封面大图片建议尺寸：640像素 * 480像素</p>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-12">
                    <div class="form-control" style="height:auto">
                        <label style="color:#333;font-size: 1.2rem;margin-bottom: 1rem">介绍文字</label>
                        <textarea name="summary" class="layui-input rw60" style="height: 200px">{$vo.summary|default=""}</textarea>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-12">
                    <textarea name="content">{$vo.content|default=""}</textarea>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon">跳转链接</span>
                        <input title="跳转链接不能为空哦" placeholder="请输入跳转链接" name='link' value="{$vo.link|default=''}" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="form-actions">
                <div class="row">
                    <div class="layui-form-item text-center">
                        <button class="layui-btn" type='submit'>保存数据</button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<!--右侧编辑区 结束-->

{/block}


{block name='script'}
<script>
    $(function () {
        $('body').on('change', '.upload-image-box input', function () {
            $('.news-item.active').css('background-image', 'url(' + this.value + ')');
            $(this).parent('.upload-image-box').css('background-image', 'url(' + this.value + ')');
        });

        // 编辑器
        require(['jquery', 'ckeditor', 'angular'], function () {
            window.form.render();
            window.createEditor('[name="content"]', {height: 360, width:750});

        });
    });
</script>
{/block}

{block name="style"}
<style>
    .panel{border-radius:0}
    .article-right {position:absolute;left:20px;position:absolute;}
    .article-right .layui-input{border-radius:0;border:1px solid #e5e6e7;}
    .article-right .layui-input:hover, .news-right .layui-input:focus{border-color:#e5e6e7!important;}
    .article-right .input-group-addon{background:#fff;border-radius:0;border-color:#e5e6e7;}
    .article-right .upload-image-box{width:150px;height:120px;background-size:cover;background-position:center center;}
</style>
{/block}